// tslint:disable-next-line:variable-name
export const KeyboardKeys = {
  '0': 0,
  '1': 1,
  '2': 2,
  '3': 3,
  '4': 4,
  '5': 5,
  '6': 6,
  '7': 7,
  '8': 8,
  '9': 9,
  Power: 10,
  Eject: 11,
  Abort: 12,
  Help: 13,
  Backspace: 14,
  Tab: 15,
  Numpad5: 16,
  NumpadEnter: 17,
  Enter: 18,
  '\r': 19,
  '\n': 20,
  ShiftLeft: 21,
  ShiftRight: 22,
  ControlLeft: 23,
  ControlRight: 24,
  AltLeft: 25,
  AltRight: 26,
  Pause: 27,
  CapsLock: 28,
  Escape: 29,
  Convert: 30,
  NonConvert: 31,
  Space: 32,
  Numpad9: 33,
  PageUp: 34,
  Numpad3: 35,
  PageDown: 36,
  End: 37,
  Numpad1: 38,
  Home: 39,
  Numpad7: 40,
  ArrowLeft: 41,
  Numpad4: 42,
  Numpad8: 43,
  ArrowUp: 44,
  ArrowRight: 45,
  Numpad6: 46,
  Numpad2: 47,
  ArrowDown: 48,
  Select: 49,
  Open: 50,
  PrintScreen: 51,
  Insert: 52,
  Numpad0: 53,
  Delete: 54,
  NumpadDecimal: 55,
  Digit0: 56,
  Digit1: 57,
  Digit2: 58,
  Digit3: 59,
  Digit4: 60,
  Digit5: 61,
  Digit6: 62,
  Digit7: 63,
  Digit8: 64,
  Digit9: 65,
  KeyA: 66,
  KeyB: 67,
  KeyC: 68,
  KeyD: 69,
  KeyE: 70,
  KeyF: 71,
  KeyG: 72,
  KeyH: 73,
  KeyI: 74,
  KeyJ: 75,
  KeyK: 76,
  KeyL: 77,
  KeyM: 78,
  KeyN: 79,
  KeyO: 80,
  KeyP: 81,
  KeyQ: 82,
  KeyR: 83,
  KeyS: 84,
  KeyT: 85,
  KeyU: 86,
  KeyV: 87,
  KeyW: 88,
  KeyX: 89,
  KeyY: 90,
  KeyZ: 91,
  MetaLeft: 92,
  MetaRight: 93,
  ContextMenu: 94,
  NumpadMultiply: 95,
  NumpadAdd: 96,
  NumpadSubtract: 97,
  NumpadDivide: 98,
  F1: 99,
  F2: 100,
  F3: 101,
  F4: 102,
  F5: 103,
  F6: 104,
  F7: 105,
  F8: 106,
  F9: 107,
  F10: 108,
  F11: 109,
  F12: 110,
  F13: 111,
  F14: 112,
  F15: 113,
  F16: 114,
  F17: 115,
  F18: 116,
  F19: 117,
  F20: 118,
  F21: 119,
  F22: 120,
  F23: 121,
  F24: 122,
  NumLock: 123,
  ScrollLock: 124,
  AudioVolumeMute: 125,
  AudioVolumeDown: 126,
  AudioVolumeUp: 127,
  MediaTrackNext: 128,
  MediaTrackPrevious: 129,
  MediaStop: 130,
  MediaPlayPause: 131,
  Semicolon: 132,
  Equal: 133,
  NumpadEqual: 134,
  Comma: 135,
  Minus: 136,
  Period: 137,
  Slash: 138,
  Backquote: 139,
  BracketLeft: 140,
  Backslash: 141,
  BracketRight: 142,
  Quote: 143,
  AltGraph: 144,
  Props: 145,
  Cancel: 146,
  Clear: 147,
  Shift: 148,
  Control: 149,
  Alt: 150,
  Accept: 151,
  ModeChange: 152,
  ' ': 153,
  Print: 154,
  Execute: 155,
  '\u0000': 156,
  a: 157,
  b: 158,
  c: 159,
  d: 160,
  e: 161,
  f: 162,
  g: 163,
  h: 164,
  i: 165,
  j: 166,
  k: 167,
  l: 168,
  m: 169,
  n: 170,
  o: 171,
  p: 172,
  q: 173,
  r: 174,
  s: 175,
  t: 176,
  u: 177,
  v: 178,
  w: 179,
  x: 180,
  y: 181,
  z: 182,
  Meta: 183,
  '*': 184,
  '+': 185,
  '-': 186,
  '/': 187,
  ';': 188,
  '=': 189,
  ',': 245,
  '.': 191,
  '`': 192,
  '[': 193,
  '\\': 194,
  ']': 195,
  "'": 196,
  Attn: 197,
  CrSel: 198,
  ExSel: 199,
  EraseEof: 200,
  Play: 201,
  ZoomOut: 202,
  ')': 203,
  '!': 204,
  '@': 205,
  '#': 206,
  $: 207,
  '%': 208,
  '^': 209,
  '&': 210,
  '(': 211,
  A: 212,
  B: 213,
  C: 214,
  D: 215,
  E: 216,
  F: 217,
  G: 218,
  H: 219,
  I: 220,
  J: 221,
  K: 222,
  L: 223,
  M: 224,
  N: 225,
  O: 226,
  P: 227,
  Q: 228,
  R: 229,
  S: 230,
  T: 231,
  U: 232,
  V: 233,
  W: 234,
  X: 235,
  Y: 236,
  Z: 237,
  ':': 238,
  '<': 239,
  _: 240,
  '>': 241,
  '?': 242,
  '~': 243,
  '{': 244,
  '}': 246,
  '"': 247,
  SoftLeft: 248,
  SoftRight: 249,
  Camera: 250,
  Call: 251,
  EndCall: 252,
  VolumeDown: 253,
  VolumeUp: 254,
} as const;

export function getKeyboardChar(keyCode: IKeyboardKeyCode) {
  for (const [char, code] of Object.entries(KeyboardKeys)) {
    if (code === keyCode) {
      return char;
    }
  }
}

export type IKeyboardKey = keyof typeof KeyboardKeys;
export type IKeyboardKeyCode = typeof KeyboardKeys[IKeyboardKey];
export type IKeyboardKeyCodes = IKeyboardKeyCode[];
